package com.yjd.api.user;

import com.yjd.comm.auth.service.ILivingBodyAuthService;
import com.yjd.comm.base.control.BaseControl;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * 活体认证回调地址
 */
@Controller
@Scope("prototype")
@RequestMapping("/livingBody/CallBack")
public class LivingBodyAuthCallBackControl extends BaseControl {

    @RequestMapping("/success/{bus_type}/{user_id}/{id}")
    public String success(@PathVariable("bus_type") Integer bus_type,@PathVariable("user_id") Long user_id,@PathVariable("id") Long id) throws Exception {
        livingBodyAuthService.authCallback(user_id,bus_type,id,1);
        return "livingbody/success";
    }

    @RequestMapping("/fail/{bus_type}/{user_id}/{id}")
    public String fail(@PathVariable("bus_type") Integer bus_type,@PathVariable("user_id") Long user_id,@PathVariable("id") Long id) throws Exception {
        livingBodyAuthService.authCallback(user_id,bus_type,id,2);
        return "livingbody/fail";
    }
    @Resource
    private ILivingBodyAuthService livingBodyAuthService;
}
